<template>
  <section style="padding-bottom: 30px;">
    <div class="header">
      <span>车牌号</span>
      <span>{{rcarnum}}</span>
    </div>
    <div style="padding-bottom: 1.2rem;"></div>
    <div class="big_pt" v-if="result == '请求成功'">
      <div class="tit">
        <img src="../../assets/index/line.png" class="line">
        <span class="weight">车辆信息</span>
      </div>
      <ul>
        <li>
          <span>品牌名称</span>
          <span>{{brandName}}</span>
        </li>
        <li>
          <span>车身颜色</span>
          <span>{{bodyColor}}</span>
        </li>
        <li>
          <span>号牌种类</span>
          <span>{{cartype}}</span>
        </li>
        <li>
          <span>使用性质</span>
          <span>{{useType}}</span>
        </li>
        <li>
          <span>车辆类型</span>
          <span>{{vehicleType}}</span>
        </li>
        <li>
          <span>机动车所有人</span>
          <span>{{owner}}</span>
        </li>
        <li>
          <span>核定载客数</span>
          <span>{{passengers}}</span>
        </li>
        <li>
          <span>初次登记日期</span>
          <span>{{firstIssueDate}}</span>
        </li>
        <li>
          <span>燃料种类</span>
          <span>{{fuelType}}</span>
        </li>
        <li>
          <span>检验有效期止</span>
          <span>{{validityDayEnd}}</span>
        </li>
        <li>
          <span>发动机号</span>
          <span>{{engineNumber}}</span>
        </li>
        <li>
          <span>车架号</span>
          <span>{{vin}}</span>
        </li>
        <li>
          <span>发动机型号</span>
          <span>{{engineModel}}</span>
        </li>
        <li>
          <span>车牌型号</span>
          <span>{{vehicleModelc}}</span>
        </li>
        <li>
          <span>排量</span>
          <span>{{cc}}</span>
        </li>
        <li>
          <span>车辆状态</span>
          <span>{{vehicleStatus}}</span>
        </li>
        <li>
          <span>出厂日期</span>
          <span>{{ppsDate}}</span>
        </li>
        <li>
          <span>强制报废期止</span>
          <span>{{retirementDate}}</span>
        </li>
        <li>
          <span>最大功率（KW）</span>
          <span>{{maxJourney}}</span>
        </li>
        <li>
          <span>轴数</span>
          <span>{{shaft}}</span>
        </li>
        <li>
          <span>总质量（kg）</span>
          <span>{{crossWeight}}</span>
        </li>
        <li>
          <span>轴距（mm）</span>
          <span>{{wheelBase}}</span>
        </li>
        <li>
          <span>整备质量（kg）</span>
          <span>{{curbWeight}}</span>
        </li>
        <li>
          <span>前轮距（mm）</span>
          <span>{{frontTread}}</span>
        </li>
        <li>
          <span>核定载质量（kg）</span>
          <span>{{loadWeight}}</span>
        </li>
        <li>
          <span>后轮距（mm）</span>
          <span>{{rearTread}}</span>
        </li>
      </ul>
    </div>
    <div v-else>
      <img src="../../assets/sech/no_tip.png" style="width: 4rem;margin-top: .86rem;">
      <p style="margin-top: .3rem;color: #666;">{{result}}</p>
    </div>
  </section>
</template>

<script>
  export default {
    name: "driverCardResult",
    data() {
      return {
        rcarnum:'',
        cartype:'',
        vehicleModelc:'',
        brandName:'',
        bodyColor:'',
        useType:'',
        vehicleType:'',
        owner:'',
        passengers:'',
        firstIssueDate:'',
        fuelType:'',
        validityDayEnd:'',
        engineNumber:'',
        vin:'',
        vehicleStatus:'',
        engineModel:'',
        cc:'',
        ppsDate:'',
        retirementDate:'',
        maxJourney:'',
        shaft:'',
        crossWeight:'',
        wheelBase:'',
        curbWeight:'',
        frontTread:'',
        loadWeight:'',
        rearTread:'',
        result:'',
      }
    },
    created() {
      let RESULTINFO = JSON.parse(sessionStorage.getItem('TO_OBJECT'));
      console.log(RESULTINFO)
      this.rcarnum = RESULTINFO.carnum;
      if (RESULTINFO.message == '请求成功') {
        this.cartype = RESULTINFO.cartype;
        this.vehicleModelc = RESULTINFO.resultInfo.vehicleModelc;
        this.brandName = RESULTINFO.resultInfo.brandName;
        this.bodyColor = RESULTINFO.resultInfo.bodyColor;
        this.useType = RESULTINFO.resultInfo.useType;
        this.vehicleType = RESULTINFO.resultInfo.vehicleType;
        this.owner = RESULTINFO.resultInfo.owner;
        this.passengers = RESULTINFO.resultInfo.passengers;
        this.firstIssueDate = RESULTINFO.resultInfo.firstIssueDate;
        switch (RESULTINFO.resultInfo.fuelType) {
          case 'A':
            this.fuelType = '汽油';
            break;
          case 'B':
            this.fuelType = '柴油';
            break;
          case 'C':
            this.fuelType = '电驱动（电能驱动汽车）';
            break;
          case 'D':
            this.fuelType = '混合油';
            break;
          case 'E':
            this.fuelType = '天然气';
            break;
          case 'F':
            this.fuelType = '液化石油气';
            break;
          case 'L':
            this.fuelType = '甲醇';
            break;
          case 'M':
            this.fuelType = '乙醇';
            break;
          case 'N':
            this.fuelType = '太阳能';
            break;
          case 'O':
            this.fuelType = '混合动力';
            break;
          case 'Y':
            this.fuelType = '无（仅限全挂车等无动力的）';
            break;
          case 'Z':
            this.fuelType = '其他';
            break;
          case 'P':
            this.fuelType = '插电式混合动力';
            break;
          case 'Q':
            this.fuelType = '氢气';
            break;
          default:
            this.fuelType = '';
        }
        this.validityDayEnd = RESULTINFO.resultInfo.validityDayEnd.substr(0,10);
        this.engineNumber = RESULTINFO.resultInfo.engineNumber;
        this.vin = RESULTINFO.resultInfo.vin;
        this.vehicleStatus = RESULTINFO.resultInfo.vehicleStatus;
        this.engineModel = RESULTINFO.resultInfo.engineModel;
        this.cc = RESULTINFO.resultInfo.cc;
        this.ppsDate = RESULTINFO.resultInfo.ppsDate.substr(0,10);
        this.retirementDate = RESULTINFO.resultInfo.retirementDate.substr(0,10);
        this.maxJourney = RESULTINFO.resultInfo.maxJourney;
        this.shaft = RESULTINFO.resultInfo.shaft;
        this.crossWeight = RESULTINFO.resultInfo.crossWeight;
        this.wheelBase = RESULTINFO.resultInfo.wheelBase;
        this.curbWeight = RESULTINFO.resultInfo.curbWeight;
        this.frontTread = RESULTINFO.resultInfo.frontTread;
        this.loadWeight = RESULTINFO.resultInfo.loadWeight;
        this.rearTread = RESULTINFO.resultInfo.rearTread;
        this.result = '请求成功';
      } else {
        this.result = RESULTINFO.message;
      }
    }
  }
</script>

<style scoped>
  .header {
    width: 100%;
    height: .8rem;
    display: flex;
    align-items: center;
    box-shadow: 2px 2px 10px rgba(128, 128, 128, .2);
    padding-left: .3rem;
    position: fixed;
    top: 0;
    left: 0;
    background: #fff;
    z-index: 999;
  }

  .header span:nth-child(1) {
    width: 2.4rem;
    text-align: left;
    color: #929292;
  }
  .line {
    width: 5px;
    height: 25px;
    position: absolute;
    left: 0;
  }

  .tit {
    display: flex;
    align-items: center;
    height: 1rem;
  }

  .big_pt {
    padding: 0rem .3rem 0rem .3rem;
    box-shadow: 2px 2px 10px rgba(128, 128, 128, .2);
  }

  .big_pt ul {
    padding-top: .3rem;
    border-top: 1px solid #f2f2f2;
  }

  .big_pt li {
    display: flex;
    text-align: left;
    padding-bottom: .3rem;
    align-items: center;
  }

  .big_pt li span:nth-child(1) {
    width: 2.4rem;
    color: #929292;
    flex: none;
  }

</style>
